package com.yykj.tencent.im.server.bean.message;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yykj.tencent.im.client.message.MsgType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 图像消息元素
 *
 */
@Data
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TIMImageMsgElement extends TIMMsgElement {
    @JsonProperty("MsgContent")
    private ImageMsgContent msgContent;


    public TIMImageMsgElement(ImageMsgContent msgContent) {
        super(MsgType.TIM_IMAGE_ELEM);
        this.msgContent = msgContent;
    }

    public TIMImageMsgElement(String uuid, Integer imageFormat, List<ImageInfo> imageInfoArray) {
        this(new ImageMsgContent(uuid, imageFormat, imageInfoArray));
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class ImageMsgContent {
        @JsonProperty("UUID")
        private String uuid;

        @JsonProperty("ImageFormat")
        private Integer imageFormat;

        @JsonProperty("ImageInfoArray")
        private List<ImageInfo> imageInfoArray;

    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class ImageInfo {
        @JsonProperty("Type")
        private Integer type;

        @JsonProperty("Size")
        private Integer size;

        @JsonProperty("Width")
        private Integer width;

        @JsonProperty("Height")
        private Integer height;

        @JsonProperty("URL")
        private String url;


    }
}
